#!/bin/bash

set -e # 命令出错就退出
trap 'catchError $LINENO $BASH_COMMAND' SIGHUP SIGINT SIGQUIT EXIT # 捕获错误情况

catchError() {
    exit_code=$?
    if [ $exit_code -ne 0 ]; then
        fail "\033[31mcommand: $2\n  at $0:$1\n  at $STEP\033[0m"
    fi
    exit $exit_code
}

success() {
    echo -e "\033[42;37m 成功 \033[0m $1"
}

fail() {
    echo -e "\033[41;37m 失败 \033[0m $1"
}

echo "start $UID"
python --version
echo "docker node version: $( node --version )"

cd /workspace
rm -rf node nwjs package.nw
# 
# exec ./tools/rebuild-node-modules 0.53.1
./tools/setup-wechat-devtools-bash

# chmod -R 777 tmp node nwjs package.nw
# ls -l package.nw
